package com.csd.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.csd.activity.AuditingActivity;
import com.csd.activity.EnterpriseOrderActivity;
import com.csd.activity.PersonalOrderActivity;
import com.csd.activity.R;
import com.csd.base.BaseFragment;
import com.csd.view.BadgeView;
import com.csd.view.MenuPopupwindow;

public class OrderFragment extends BaseFragment {

//	private ActionBar actionBar;
	private LinearLayout ll_auditing, ll_allBusines, ll_allPrivate;
	private TextView tv_orderAuditing, tv_orderSelect, tv_orderOut,
			tv_orderReturn;
	private TextView tv_privatePay, tv_privateOut, tv_privateReturn,
			tv_privateSettle,tv_autiding;
	private ImageView img_order;


	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {
		case R.id.auditing:
			Intent intent = new Intent(getActivity(), AuditingActivity.class);
			startActivity(intent);
			break;
		case R.id.order_auditing:
			toEnterpriseOrderActivity(1);
			break;
		case R.id.order_select:
			toEnterpriseOrderActivity(2);
			break;
		case R.id.order_out:
			toEnterpriseOrderActivity(3);
			break;
		case R.id.order_reture:
			toEnterpriseOrderActivity(4);
			break;
		case R.id.allBusines_order:
			toEnterpriseOrderActivity(0);
			break;
		case R.id.allPrivate_order:
			toPermentOrderActivity(0);
			break;
		case R.id.private_pay:
			toPermentOrderActivity(1);
			break;
		case R.id.private_out:
			toPermentOrderActivity(2);
			break;
		case R.id.private_return:
			toPermentOrderActivity(3);
			break;
		case R.id.private_settle:
			toPermentOrderActivity(4);
			break;
		case R.id.order_img:
			MenuPopupwindow menu = new MenuPopupwindow(getActivity());
			menu.showPopupWindow(img_order);
			break;
		default:
			
			break;
		}
	}

	public void toEnterpriseOrderActivity(int i) {
		Intent intent = new Intent(getActivity(), EnterpriseOrderActivity.class);
		intent.putExtra("num", i);
		startActivity(intent);
	}

	public void toPermentOrderActivity(int i) {
		Intent intent = new Intent(getActivity(), PersonalOrderActivity.class);
		intent.putExtra("num", i);
		startActivity(intent);
	}

	@Override
	protected View initView(LayoutInflater inflater) {
		rootView = inflater.inflate(R.layout.fragment_order, null);
		return rootView;
	}

	@Override
	protected void findViewById() {
		// TODO Auto-generated method stub
		ll_auditing = (LinearLayout) rootView.findViewById(R.id.auditing);
		tv_orderAuditing = (TextView) rootView.findViewById(R.id.order_auditing);
		tv_orderOut = (TextView) rootView.findViewById(R.id.order_out);
		tv_orderSelect = (TextView) rootView.findViewById(R.id.order_select);
		tv_orderReturn = (TextView) rootView.findViewById(R.id.order_reture);
		ll_allBusines = (LinearLayout) rootView.findViewById(R.id.allBusines_order);
		ll_allPrivate = (LinearLayout) rootView.findViewById(R.id.allPrivate_order);
		tv_privatePay = (TextView) rootView.findViewById(R.id.private_pay);
		tv_privateOut = (TextView) rootView.findViewById(R.id.private_out);
		tv_privateReturn = (TextView) rootView.findViewById(R.id.private_return);
		tv_privateSettle = (TextView) rootView.findViewById(R.id.private_settle);
		tv_autiding = (TextView) rootView.findViewById(R.id.tv_auditing);
		img_order = (ImageView) rootView.findViewById(R.id.order_img);
	}

	@Override
	protected void setListener() {
		// TODO Auto-generated method stub
		ll_auditing.setOnClickListener(this);
		tv_orderAuditing.setOnClickListener(this);
		tv_orderSelect.setOnClickListener(this);
		tv_orderOut.setOnClickListener(this);
		tv_orderReturn.setOnClickListener(this);
		ll_allBusines.setOnClickListener(this);
		ll_allPrivate.setOnClickListener(this);
		tv_privatePay.setOnClickListener(this);
		tv_privateOut.setOnClickListener(this);
		tv_privateReturn.setOnClickListener(this);
		tv_privateSettle.setOnClickListener(this);
		img_order.setOnClickListener(this);
	}

	@Override
	protected void initData(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		
	}
}
